<%@ page language="java" pageEncoding="utf8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>"
			type="text/css" />
		<style type="">
#rule_h3 {
	border-bottom: 1px solid #BBBBBB;
	font-size: 14px;
	font-weight: bold;
	margin: 20px 0 15px;
	padding: 5px 2px 6px 5px;
}
</style>
	</head>
	<body style="">
		<div id="headBar" class="head_content"></div>
		<div id="main" class="main_content">
			<form method="post" id="activity_form" action="mt_activity_save.html">
				<input name="marketPromotionActivity.pmtaId"
					value="${marketPromotionActivity.pmtaId }" type="hidden" />

				<div class="tableform">
					<div class="division">
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tbody>
								<tr>
									<th>
										促销活动名称:
									</th>
									<td>
										<input type="text" name="marketPromotionActivity.pmtaName"
											class="x-input " value="${marketPromotionActivity.pmtaName }">
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="division">
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tbody>
								<tr>
									<th>
										是否发布:
									</th>
									<td>
										<select name="marketPromotionActivity.pmtaEnabled"
											id="activity_pmtaEnabled">
											<option value="true">
												是
											</option>
											<option value="false">
												否
											</option>
										</select>
									</td>
								</tr>
								<tr>
									<th>
										开始时间:
									</th>
									<td>
										<input size="10" id="activity_begin_time"
											name="marketPromotionActivity.pmtaTimeBeginString"
											value="${marketPromotionActivity.pmtaTimeBeginString}"
											class="cal cal" type="text" />
									</td>
								</tr>
								<tr>
									<th>
										结束时间:
									</th>
									<td>
										<input size="10" id="activity_end_time"
											name="marketPromotionActivity.pmtaTimeEndString"
											value="${marketPromotionActivity.pmtaTimeEndString}"
											class="cal cal" type="text" />
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="division">
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tbody>
								<tr>
									<th>
										促销活动描述:
									</th>
									<td>
										<textarea vtype="required" class="x-input" rows="6" cols="60"
											name="marketPromotionActivity.pmtaDescribe">${marketPromotionActivity.pmtaDescribe}</textarea>

									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="table-action">
						<button class="btn" type="submit">
							<span><span>下一步</span> </span>
						</button>
						<button class="btn" type="button">
							<span><span>取消</span> </span>
						</button>
					</div>
				</div>

			</form>

			<c:if test="${not empty marketPromotionActivity.pmtaId}">
				<div>
					<h3 id="rule_h3">
						促销规则
					</h3>
					<div class="division">
						<button class="btn" type="button"> <span><span>添加促销规则</span></span>
						</button>
						<button class="btn" type="button">
							<span><span>删除选中</span> </span>
						</button>
						<form method="post" action="" id="pmts_list_form"
							class="table-grid">
							<table class="gridlist">
								<thead>
									<tr>
										<th style="width: 50px;">
											操作
										</th>
										<th>
											规则描述
										</th>
										<th>
											起始时间
										</th>
										<th>
											截止时间
										</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="marketPromotion"
										items="${marketPromotions}" varStatus="index">
										<tr>
											<td>
												<a	href="mt_activity_rule_begin.html?marketPromotionActivity.pmtaId=${marketPromotionActivity.pmtaId}&pmtId=${marketPromotion.pmtId}&pmtsId=${marketPromotion.pmtsId}">编辑</a>
												<input type="checkbox" value="24" name="pmt_id[]">
											</td>
											<td>
												${marketPromotion.pmtDescribe }
											</td>
											<td>
												${marketPromotion.pmtTimeBeginString }
											</td>
											<td>
												${marketPromotion.pmtTimeEndString }
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</form>
					</div>
				</div>
			</c:if>
		</div>
		<div id="footBar" class="foot_content"></div>



		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/ckeditor.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/adapters/jquery.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.validate.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.core.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.widget.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.datepicker.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/i18n/jquery.ui.datepicker-zh-CN.js'/>"></script>
		<script type="text/javascript">
<c:if test="${not empty marketPromotionActivity.pmtaId }">
	$('#activity_pmtaEnabled').attr('value','${marketPromotionActivity.pmtaEnabled}');
</c:if>
	$(document).ready(function() {
		var validator = $("#activity_form").validate( {
			errorElement : "div",
			errorClass : "x-vali-error",
			onfocusout : false,
			rules : {
				'marketPromotionActivity.pmtaName' : "required",
				'marketPromotionActivity.pmtaDescribe' : {
					required : true 
				},
				'marketPromotionActivity.pmtaTimeBeginString' : "required",
				'marketPromotionActivity.pmtaTimeEndString' : "required",
				 
			},
			messages : {
				'marketPromotionActivity.pmtaName' : "必填字段",
				'marketPromotionActivity.pmtaDescribe' : {
					required : "必填字段" 
				},
				'marketPromotionActivity.pmtaTimeBeginString' : "必填字段",
				'marketPromotionActivity.pmtaTimeEndString' : "必填字段" 
			},
			errorPlacement : function(error, element) {
				element.removeClass('x-vali-error');
				error.appendTo(element.parent());

			},

			success : function(div) {
				$(div).remove();
			}
		});
	});

	$("#activity_begin_time").datepicker($.datepicker.regional['zh-CN']);
	$("#activity_end_time").datepicker($.datepicker.regional['zh-CN']);
</script>
	</body>
</html>